package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.PersonMessage;
import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.domain.SystemMessage;
import cn.wolfcode.trip.base.service.ISendMeService;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import cn.wolfcode.trip.base.service.ISystemMessageService;
import cn.wolfcode.trip.base.service.ITravelService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("sendMe")
public class SendMeMessageController {
    @Autowired
    private ISendMeService sendMeService;
    @Autowired
    private ITravelService travelService;

    @Autowired
    private IStrategyCommentService commentService;

    @GetMapping
    public Object list(Long targetId, int state){
        List<StrategyComment> StrategyComment = commentService.queryLsit(targetId, state);
        return StrategyComment;
    }

    @PutMapping
    public void changeState(int state,Long targetId){
        sendMeService.changeState(state, targetId);
    }

    @GetMapping("{targetId}")
    public Object selectByTargetId(@PathVariable Long targetId) {
          return travelService.selectByTargetId(targetId);
    }
}
